package cn.webrx;

import java.awt.*;

public class Math1 {
    //int i = 6;

    public static void main(String[] args) {


        //在java语言java.lang包类，可以在程序直接使用
        //String str = "hello";
        //System.out.println(Math.PI);

        System.out.println(Math.PI);
        System.out.println(Math.random());
        System.out.println((int) Math.pow(3, 2));
        System.out.println((int) 1.9);
        System.out.println((int) 1.1);

        //Math工具类，java.lang.Math;
        //.round() 四舍五入
        System.out.println(Math.round(1.9)); //2
        System.out.println(Math.round(1.1)); //1

        //小数必须入 5.1 房间
        System.out.println((int) Math.ceil(1.1));//2
        System.out.println((int) Math.ceil(1.9));//2

        //小数必须舍 10.9 人 10
        System.out.println(Math.round(Math.floor(1.1))); //1
        System.out.println(Math.round(Math.floor(1.9)));//1

        //System.out.println(Math.abs());
        //System.out.println(Math.cos());
        //System.out.println(Math.sin());

        int red = (int)Math.round(Math.random()*256);
        int green = (int)Math.round(Math.random()*256);
        int blue = (int)Math.round(Math.random()*256);
        System.out.printf("#%02x%02x%02x%n",red,green,blue);

        //#a97130
        Color c = new Color(0x08,0x39,0x16);

    }
}
